﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace pardusshipcalc.FSC
{
    class FSC_Compatibility
    {
            private string[] supported = { "FSCv4.2", "FSCv4.3" };

            int fscVersion;

            public FSC_Compatibility(string version)
            {
                if (version == "FSCv4.2")
                {
                    fscVersion = 1;
                }
                if (version == "FSCv4.3")
                {
                    fscVersion = 2;
                }
            }

        public string[] getFSC_Version()
        {
            return supported;
        }



        public string exportShipToFsc(ComboBox shipSelectBox)
        {            
            int index = 0;

            

            string[,] nameLUT = {
                                   {"- Sabre", "0", "0"},
                                   {"- Rustclaw", "1", "1"},
                                   {"- Interceptor", "2","2"},
                                   {"- Lanner Mini", "3","3"},
                                   {"- Harrier", "4","4"},
                                   {"- Mercury", "5","5"},
                                   {"- Hercules", "6","6"},
                                   {"- Lanner", "7","7"},
                                   {"- Hawk", "8","8"},
                                   {"- Gargantua", "9","9"},
                                   {"- Behemoth", "10","10"},
                                   {"- Liberator", "11","11"},
                                   {"- Leviathan", "ERR","12"},
                                   {"- Wasp", "12", "13"},
                                   {"- Adder", "13","14"},
                                   {"- Thunderbird", "14","15"},
                                   {"- Viper Defence Craft", "15","16"},
                                   {"- Babel Transporter","16","17"},
                                   {"- Piranha","17","18"},
                                   {"- Nighthawk","18","19"},
                                   {"- Nighthawk Deluxe","19","20"},
                                   {"- Mantis", "20", "21"},
                                   {"- Extender","21","22"},
                                   {"- Gauntlet", "22","23"},
                                   {"- Doomstar","23","24"},
                                   {"- War Nova", "24","25"},
                                   {"- Ficon", "25","26"},
                                   {"- Tyrant", "26","27"},
                                   {"- Spectre", "27","28"},
                                   {"- Shadow Stealth Craft", "28","29"},
                                   {"- Venom", "29","30"},
                                   {"- Constrictor", "30","31"},
                                   {"- Phantom Advanced Stealth Craft", "31","32"},
                                   {"- Dominator", "32","33"},
                                   {"- Boa Ultimate Carrier", "33","34"},
                                   {"- Mooncrusher", "34","35"},
                                   {"- Rustfire", "35","36"},
                                   {"- Marauder", "36","37"},
                                   {"- Junker IV", "37","38"},
                                   {"- Slider","38","39"},
                                   {"- El Padre", "39","40"},
                                   {"- Chitin", "40","41"},
                                   {"- Horpor", "41","42"},
                                   {"- Scorpion", "42","43"},
                                   {"- Trident", "43","44"},
                                   {"- Celeus", "44","45"},
                                   {"- Pantagruel", "45","46"},
                                   {"- Vulcan", "46","47"},
                                   {"- Nano", "47", "48"},
                                   {"- Liberator EPS", "48","49"},
                                   {"- Rover", "49", "50"},
                                   {"- Reaper", "50","51"},
                                   {"- Blood Lanner", "51", "52"},
                                   {"- Sudden Death", "52", "53"}
                               };

            for (index = 0; index < nameLUT.Length; index++)
            {
                if (nameLUT[index,0] == shipSelectBox.Text)
                {
                        return nameLUT[index,fscVersion];
                }
            }
            return "err";
        }

        private void parseShipID(ref string[] import, ComboBox shipSelectBox)
        {
            int shipIndex =0;

            switch (import[2])
            {
                case "":
                    shipSelectBox.Text = "- Sabre";
                    break;

                case "1":
                    shipSelectBox.Text = "- Rustclaw";
                    break;

                case "2":
                    shipSelectBox.Text = "- Interceptor";
                    break;

                case "3":
                    shipSelectBox.Text = "- Lanner Mini";
                    break;

                case "4":
                    shipSelectBox.Text = "- Harrier";
                    break;

                case "5":
                    shipSelectBox.Text = "- Mercury";
                    break;

                case "6":
                    shipSelectBox.Text = "- Hercules";
                    break;

                case "7":
                    shipSelectBox.Text = "- Lanner";
                    break;

                case "8":
                    shipSelectBox.Text = "- Hawk";
                    break;

                case "9":
                    shipSelectBox.Text = "- Gargantua";
                    break;

                case "10":
                    shipSelectBox.Text = "- Behemoth";
                    break;

                case "11":
                    shipSelectBox.Text = "- Liberator";
                    break;

                case "12":
                    shipSelectBox.Text = "- Wasp";
                    break;

                case "13":
                    shipSelectBox.Text = "- Adder";
                    break;

                case "14":
                    shipSelectBox.Text = "- Thunderbird";
                    break;

                case "15":
                    shipSelectBox.Text = "- Viper Defence Craft";
                    break;

                case "16":
                    shipSelectBox.Text = "- Babel Transporter";
                    break;

                case "17":
                    shipSelectBox.Text = "- Piranha";
                    break;

                case "18":
                    shipSelectBox.Text = "- Nighthawk";
                    break;

                case "19":
                    shipSelectBox.Text = "- Nighthawk Deluxe";
                    break;

                case "20":
                    shipSelectBox.Text = "- Mantis";
                    break;

                case "21":
                    shipSelectBox.Text = "- Extender";
                    break;

                case "22":
                    shipSelectBox.Text = "- Gauntlet";
                    break;

                case "23":
                    shipSelectBox.Text = "- Doomstar";
                    break;

                case "24":
                    shipSelectBox.Text = "- War Nova";
                    break;

                case "25":
                    shipSelectBox.Text = "- Ficon";
                    break;

                case "26":
                    shipSelectBox.Text = "- Tyrant";
                    break;

                case "27":
                    shipSelectBox.Text = "- Spectre";
                    break;

                case "28":
                    shipSelectBox.Text = "- Shadow Stealth Craft";
                    break;

                case "29":
                    shipSelectBox.Text = "- Venom";
                    break;

                case "30":
                    shipSelectBox.Text = "- Constrictor";
                    break;

                case "31":
                    shipSelectBox.Text = "- Phantom Advanced Stealth Craft";
                    break;

                case "32":
                    shipSelectBox.Text = "- Dominator";
                    break;

                case "33":
                    shipSelectBox.Text = "- Boa Ultimate Carrier";
                    break;

                case "34":
                    shipSelectBox.Text = "- Mooncrusher";
                    break;

                case "35":
                    shipSelectBox.Text = "- Rustfire";
                    break;

                case "36":
                    shipSelectBox.Text = "- Marauder";
                    break;

                case "37":
                    shipSelectBox.Text = "- Junker IV";
                    break;

                case "38":
                    shipSelectBox.Text = "- Slider";
                    break;

                case "39":
                    shipSelectBox.Text = "- El Padre";
                    break;

                case "40":
                    shipSelectBox.Text = "- Chitin";
                    break;

                case "41":
                    shipSelectBox.Text = "- Horpor";
                    break;

                case "42":
                    shipSelectBox.Text = "- Scorpion";
                    break;

                case "49":
                    shipSelectBox.Text = "- Rover";
                    break;

                case "50":
                    shipSelectBox.Text = "- Reaper";
                    break;

                case "51":
                    shipSelectBox.Text = "- Blood Lanner";
                    break;

                case "52":
                    shipSelectBox.Text = "- Sudden Death";
                    break;

                case "43":
                    shipSelectBox.Text = "- Trident";
                    break;

                case "44":
                    shipSelectBox.Text = "- Celeus";
                    break;

                case "45":
                    shipSelectBox.Text = "- Pantagruel";
                    break;

                case "46":
                    shipSelectBox.Text = "- Vulcan";
                    break;

                case "47":
                    shipSelectBox.Text = "- Nano";
                    break;

                case "48":
                    shipSelectBox.Text = "- Liberator EPS";
                    break;
            }
        }

        private string exportGunToFSC(ComboBox gunbox)
        {
            string gun;
  
            switch (gunbox.Text)
            {
                case "10MW Mining Laser":
                    gun = "1";
                    return gun;

                case "30MW Mining Laser":
                    gun = "2";
                    return gun;

                case "1MW Impulse Laser":
                    gun = "3";
                    return gun;

                case "5MW Impulse Laser":
                    gun = "4";
                    return gun;

                case "1MW Particle Laser":
                    gun = "5";
                    return gun;

                case "4MW Particle Laser":
                    gun = "6";
                    return gun;

                case "4MW LW Particle Laser":
                    gun = "7";
                    return gun;

                case "20MW Particle Laser":
                    gun = "8";
                    return gun;

                case "20MW LW Particle Laser":
                    gun = "9";
                    return gun;

                case "100MW Particle Laser":
                    gun = "10";
                    return gun;

                case "100MW LW Particle Laser":
                    gun = "11";
                    return gun;

                case "140MW Particle Laser":
                    gun = "12";
                    return gun;

                case "140MW LW Particle Laser":
                    gun = "13";
                    return gun;

                case "4MW Gatling Laser":
                    gun = "14";
                    return gun;

                case "4MW LW Gatling Laser":
                    gun = "15";
                    return gun;

                case "6MW Gatling Laser":
                    gun = "16";
                    return gun;

                case "6MW LW Gatling Laser ":
                    gun = "17";
                    return gun;

                case "10MW Gatling Laser":
                    gun = "18";
                    return gun;

                case "10MW LW Gatling Laser":
                    gun = "19";
                    return gun;

                case "20MW Gatling Laser":
                    gun = "20";
                    return gun;

                case "20MW LW Gatling Laser":
                    gun = "21";
                    return gun;

                case "35MW Plasma":
                    gun = "22";
                    return gun;

                case "40MW Plasma":
                    gun = "23";
                    return gun;

                case "60MW Plasma":
                    gun = "24";
                    return gun;

                case "Exoplasm Launcher":
                    gun = "25";
                    return gun;

                case "Endoplasm Launcher":
                    gun = "26";
                    return gun;

                case "Bio-Spore Array":
                    gun = "27";
                    return gun;

                case "Viral Glands":
                    gun = "28";
                    return gun;

                case "80MT Magnetic Defractor":
                    gun = "29";
                    return gun;

                case "120MT Magnetic Defractor":
                    gun = "30";
                    return gun;

                case "Large Pulse Cannon":
                    gun = "31";
                    return gun;

                case "Very Large Pulse Cannon":
                    gun = "32";
                    return gun;

                case "Lucidi Enforcer I":
                    gun = "33";
                    return gun;

                case "Lucidi Enforcer II":
                    gun = "34";
                    return gun;

                case "Lucidi Conqueror":
                    gun = "35";
                    return gun;

                case "Lucidi Plasma Thrower":
                    gun = "36";
                    return gun;

                default:
                    return "";
            }
        }

        private string exportMissileToFSC(ComboBox missileBox)
        {
            string missile = "";       

            switch (missileBox.Text)
            {
                case "P80 Sidewinder":
                    missile = "1";
                    return missile;

                case "KL760 Homing":
                    missile = "2";
                    return missile;

                case "LV111 Intelligent":
                    missile = "3";
                    return missile;

                case "NN500 Fleet":
                    missile = "4";
                    return missile;

                case "NN550 Fleet":
                    missile = "5";
                    return missile;

                case "Imperial MO89 Lord":
                    missile = "6";
                    return missile;

                case "Imperial G-7 Smartwinder":
                    missile = "7";
                    return missile;

                case "A/50 Pogo":
                    missile = "8";
                    return missile;

                case "D/70 Havar":
                    missile = "9";
                    return missile;

                case "Imperial Elite Mk.I":
                    missile = "10";
                    return missile;

                case "Imperial Elite Mk.II":
                    missile = "11";
                    return missile;

                case "King Relon":
                    missile = "12";
                    return missile;

                case "King Kraak":
                    missile = "13";
                    return missile;

                case "Royal Redeemer":
                    missile = "14";
                    return missile;

                default:
                    missile = "";
                    return missile;
            }
        }

        private string exportArmorToFSC(ComboBox armorComboBox)
        {
            string armorReturnData = "";

            switch (armorComboBox.Text)
            {
                case "Titanium (x1)":
                    armorReturnData = "1";
                    return armorReturnData;

                case "Tritanium (x2)":
                    armorReturnData = "2";
                    return armorReturnData;

                case "Zortrium (x3)":
                    armorReturnData = "3";
                    return armorReturnData;

                case "Neutronium (x4)":
                    armorReturnData = "4";
                    return armorReturnData;

                case "Adamantium (x5)":
                    armorReturnData = "5";
                    return armorReturnData;

                case "Ebidium (x6)":
                    armorReturnData = "6";
                    return armorReturnData;

                case "Worm-Slime (x2)":
                    armorReturnData = "7";
                    return armorReturnData;

                case "Mykoplasmic (x3)":
                    armorReturnData = "8";
                    return armorReturnData;

                case "Mutagen (x4)":
                    armorReturnData = "9";
                    return armorReturnData;

                case "Genotrope (x5)":
                    armorReturnData = "10";
                    return armorReturnData;

                case "Fermion (x2)":
                    armorReturnData = "11";
                    return armorReturnData;

                case "Boson (x3)":
                    armorReturnData = "12";
                    return armorReturnData;

                case "Positron (x4)":
                    armorReturnData = "13";
                    return armorReturnData;

                case "Anti-Neutrino (x5)":
                    armorReturnData = "14";
                    return armorReturnData;

                case "Pardus I":
                    armorReturnData = "15";
                    return armorReturnData;

                case "Pardus II":
                    armorReturnData = "16";
                    return armorReturnData;

                case "Pardus III":
                    armorReturnData = "17";
                    return armorReturnData;

                case "Pardus IV":
                    armorReturnData = "18";
                    return armorReturnData;

                case "Pardus V":
                    armorReturnData = "19";
                    return armorReturnData;

                case "Pardus VI":
                    armorReturnData = "20";
                    return armorReturnData;

                default:
                    armorReturnData = "";
                    return armorReturnData;

            }
        }

        private string exportShieldToFSC(ComboBox shieldSelectComboBox)
        {
            string shieldReturnData = "";

            switch (shieldSelectComboBox.Text)
            {
                case "Small":
                    shieldReturnData = "1";
                    return shieldReturnData;

                case "Standard":
                    shieldReturnData = "2";
                    return shieldReturnData;

                case "Medium":
                    shieldReturnData = "3";
                    return shieldReturnData;

                case "Large":
                    shieldReturnData = "4";
                    return shieldReturnData;

                case "Tiny":
                    shieldReturnData = "5";
                    return shieldReturnData;

                case "Q-Small":
                    shieldReturnData = "6";
                    return shieldReturnData;

                case "Q-Standard":
                    shieldReturnData = "7";
                    return shieldReturnData;

                case "Q-Medium":
                    shieldReturnData = "8";
                    return shieldReturnData;

                case "Q-Large":
                    shieldReturnData = "9";
                    return shieldReturnData;

                case "Huge":
                    shieldReturnData = "10";
                    return shieldReturnData;

                case "Q-Huge":
                    shieldReturnData = "11";
                    return shieldReturnData;

                case "L-Huge":
                    shieldReturnData = "12";
                    return shieldReturnData;

                case "LQ-Large":
                    shieldReturnData = "13";
                    return shieldReturnData;

                case "LQ-Huge":
                    shieldReturnData = "14";
                    return shieldReturnData;

                default:
                    shieldReturnData = "";
                    return shieldReturnData;
            }
        }

        private string exportDriveToFSC(ComboBox driveSelectBox)
        {
            string driveReturnData = "";

            switch (driveSelectBox.Text)
            {
                case "Nuclear Drive":
                    driveReturnData = "1";
                    return driveReturnData;

                case "Fusion Drive":
                    driveReturnData = "2";
                    return driveReturnData;

                case "Enhanced Fusion Drive":
                    driveReturnData = "7";
                    return driveReturnData;

                case "Ion Drive":
                    driveReturnData = "3";
                    return driveReturnData;

                case "Antimatter Drive":
                    driveReturnData = "4";
                    return driveReturnData;

                case "Enhanced Antimatter Drive":
                    driveReturnData = "8";
                    return driveReturnData;

                case "Hyper Drive":
                    driveReturnData = "5";
                    return driveReturnData;

                case "Interphased Drive":
                    driveReturnData = "6";
                    return driveReturnData;

                case "Enhanced Interphased Drive":
                    driveReturnData = "9";
                    return driveReturnData;

                default:
                    driveReturnData = "";
                    return driveReturnData;
            }
        }


    }
}
